import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function customerEdit(data) {
  return request({
    url: '/customer/updateOne',
    method: 'post',
    data
  })
}

export function customerAdd(data) {
  return request({
    url: '/customer/insertOne',
    method: 'post',
    data
  })
}


export function logOut(data) {
  return request({
    url: '/user/logout',
    method: 'post',
    data
  })
}

export function customerList(query) {
  return request({
    url: '/customer/selectByPage',
    method: 'get',
    params: query
  })
}

export function customerInfo(query) {
  return request({
    url: '/customer/selectOne',
    method: 'get',
    params: query
  })
}

export function deleteCustomer(data) {
  return request({
    url: '/customer/deleteOne',
    method: 'post',
    data
  })
}

// 供应商方法

export function supplierList(query) {
  return request({
    url: '/supplier/selectByPage',
    method: 'get',
    params: query
  })
}

export function supplierEdit(data) {
  return request({
    url: '/supplier/updateOne',
    method: 'post',
    data
  })
}

export function supplierAdd(data) {
  return request({
    url: '/supplier/insertOne',
    method: 'post',
    data
  })
}

export function deleteSupplier(data) {
  return request({
    url: '/supplier/deleteOne',
    method: 'post',
    data
  })
}

export function supplierInfo(query) {
  return request({
    url: '/supplier/selectOne',
    method: 'get',
    params: query
  })
}

// 仓库方法

export function warehouseList(query) {
  return request({
    url: '/warehouse/selectByPage',
    method: 'get',
    params: query
  })
}

export function warehouseEdit(data) {
  return request({
    url: '/warehouse/updateOne',
    method: 'post',
    data
  })
}

export function warehouseAdd(data) {
  return request({
    url: '/warehouse/insertOne',
    method: 'post',
    data
  })
}

export function deleteWarehouse(data) {
  return request({
    url: '/warehouse/deleteOne',
    method: 'post',
    data
  })
}

export function warehouseInfo(query) {
  return request({
    url: '/warehouse/selectOne',
    method: 'get',
    params: query
  })
}

// 商品方法

export function goodsList(query) {
  return request({
    url: '/goods/selectByPage',
    method: 'get',
    params: query
  })
}

export function goodsEdit(data) {
  return request({
    url: '/goods/updateOne',
    method: 'post',
    data
  })
}

export function goodsAdd(data) {
  return request({
    url: '/goods/insertOne',
    method: 'post',
    data
  })
}

export function deleteGoods(data) {
  return request({
    url: '/goods/deleteOne',
    method: 'post',
    data
  })
}

export function goodsInfo(query) {
  return request({
    url: '/goods/selectOne',
    method: 'get',
    params: query
  })
}

// 用户方法
export function userList(query) {
  return request({
    url: '/user/selectByPage',
    method: 'get',
    params: query
  })
}

export function userFreeze(data) {
  return request({
    url: '/user/deleteOne',
    method: 'post',
    data
  })
}

export function userUnlock(data) {
  return request({
    url: '/user/resumeOne',
    method: 'post',
    data
  })
}

export function userRegister(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data
  })
}

export function userEdit (data) {
  return request({
    url: '/user/logUpdateOne',
    method: 'post',
    data
  })
}

export function checkPassword (data) {
  return request({
    url: '/user/logCheckPassword',
    method: 'post',
    data
  })
}

export function getUserInfo(query) {
  return request({
    url: '/user/logGetUserInfo',
    method: 'get',
    params: query
  })
}

// 入库信息方法
export function recordInList(query) {
  return request({
    url: '/record-in/select',
    method: 'get',
    params: query
  })
}

export function rollbackRecordIn(data) {
  return request({
    url: '/record-in/rollback',
    method: 'post',
    data
  })
}

export function supSignList() {
  return request({
    url: '/supplier/selectSupplierSigns',
    method: 'get'
  })
}

export function recordInAdd(data) {
  return request({
    url: '/record-in/insertOne',
    method: 'post',
    data
  })
}

// 出库信息方法
export function recordOutList(query) {
  return request({
    url: '/record-out/select',
    method: 'get',
    params: query
  })
}

export function cusSignList() {
  return request({
    url: '/customer/selectCustomerSigns',
    method: 'get'
  })
}

export function goodsSignList() {
  return request({
    url: '/goods/selectGoodsSigns',
    method: 'get'
  })
}

export function wareSignList() {
  return request({
    url: '/warehouse/selectWareSigns',
    method: 'get'
  })
}

export function recordOutAdd(data) {
  return request({
    url: '/record-out/insertOne',
    method: 'post',
    data
  })
}

export function rollbackRecordOut(data) {
  return request({
    url: '/record-out/rollback',
    method: 'post',
    data
  })
}

// 库存管理方法
export function inventoryList(query) {
  return request({
    url: '/inventory/select',
    method: 'get',
    params: query
  })
}

export function getSortInventoryQuartzBean() {
  return request({
    url: '/inventory/getSortInventoryQuartzBean',
    method: 'get'
  })
}

export function createSortInventoryJob(data) {
  return request({
    url: '/inventory/createSortInventoryJob',
    method: 'post',
    data
  })
}

export function inventoryMerge() {
  return request({
    url: '/inventory/inventoryMerge',
    method: 'get'
  })
}

export function pauseSortInventory() {
  return request({
    url: '/inventory/pauseSortInventory',
    method: 'get'
  })
}

export function resumeSortInventory() {
  return request({
    url: '/inventory/resumeSortInventory',
    method: 'get'
  })
}

export function runOnceSortInventory() {
  return request({
    url: '/inventory/runOnceSortInventory',
    method: 'get'
  })
}

export function updateSortInventoryCron(data) {
  return request({
    url: '/inventory/updateSortInventoryCron',
    method: 'post',
    data
  })
}

export function getInventoryAlertBean() {
  return request({
    url: '/inventory/getInventoryAlertBean',
    method: 'get'
  })
}

export function setInventoryAlertBean(data) {
  return request({
    url: '/inventory/setInventoryAlertBean',
    method: 'post',
    data
  })
}

export function deleteInventoryAlert(data) {
  return request({
    url: '/inventory-alert/delete',
    method: 'post',
    data
  })
}

export function inventoryAlertList(query) {
  return request({
    url: '/inventory-alert/select',
    method: 'get',
    params: query
  })
}

// 首页方法
export function getWarehouseStatusInfo () {
  return request({
    url: '/warehouse/getWarehouseVO',
    method: 'get'
  })
}

export function getRecordInOutInfos (query) {
  return request({
    url: '/statistic/getRecordInOutInfos',
    method: 'get',
    params: query
  })
}

export function getFinancialInfo (query) {
  return request({
    url: '/statistic/getFinancialInfo',
    method: 'get',
    params: query
  })
}

export function getGoodsSellsInfo () {
  return request({
    url: '/statistic/getGoodsSellsInfo',
    method: 'get'
  })
}

export function getFinancialType () {
  return request({
    url: '/statistic/getFinancialType',
    method: 'get'
  })
}

// 报表方法
export function getShellScripts() {
  return request({
    url: '/report-script/getShellScripts',
    method: 'get'
  })
}

export function saveShellScript(data) {
  return request({
    url: '/report-script/saveShellScript',
    method: 'post',
    data
  })
}

export function saveCron (data) {
  return request({
    url: '/report-script/saveCron',
    method: 'post',
    data
  })
}

export function getCron(query) {
  return request({
    url: '/report-script/getCron',
    method: 'get',
    params: query
  })
}

export function getLogs() {
  return request({
    url: '/report-script/getLogs',
    method: 'get'
  })
}

export function deleteLog (data) {
  return request({
    url: '/report-script/deleteOne',
    method: 'post',
    data
  })
}
